#!/bin/bash

# 获取当前时间戳（年月日时分秒）
timestamp=$(date +"%Y%m%d%H%M%S")

# 定义请求函数
make_shell_request() {
  local request_id=$1
  shell_name=$2
  path_dir=$3
  case_log_path="${path_dir}/request_${request_id}.log"
  exec_sh="${shell_name}.py"
  echo "exec_sh=$exec_sh, case_log_path=${case_log_path}"
  request_id=${request_id} python3 $exec_sh >> ${case_log_path}
}

# 启动并发请求

test_tgt="test_InternVL2_multi_process"

batch_num=${BATCH_SIZE:-'8'}
log_dir="./logs/${timestamp}_${test_tgt}_batch${batch_num}"
mkdir -p $log_dir

for ((i=0;i<${batch_num};i++));do
  make_shell_request $i ${test_tgt} ${log_dir} &
done
# 等待所有请求完成
wait
